package admin

import (
	"context"
	"server/internal/model"
	"server/internal/service"

	"server/api/admin/system"
)

func (c *ControllerSystem) CrontabUpdate(ctx context.Context, req *system.CrontabUpdateReq) (res *system.CrontabUpdateRes, err error) {
	res = new(system.CrontabUpdateRes)
	res.Affected, err = service.SystemCrontab().UpdateByID(ctx, req.Id, model.CrontabFormInput{
		CategoryId: req.CategoryID,
		Title:      req.Title,
		Name:       req.Name,
		Params:     req.Params,
		Pattern:    req.Pattern,
		Policy:     req.Policy,
		Count:      req.Count,
		Sort:       req.Sort,
		Status:     req.Status,
		Remark:     req.Remark,
	})
	return
}
